/*
 * font.h
 *
 *  Created on: May 19, 2010
 *      Author: abeldantas
 */

#ifndef FONT_H_
#define FONT_H_

#include "sprite.h"
#include "queue.h"
#include <go32.h>	

/** @name Screen and video memory definitions in text mode */
/*@{*/
#define VIDEO_TEXT 0xB8000 ///< Video address in text mode
#define WIDTH 80	   ///< Number of columns
#define HEIGHT 25	   ///< Number of rows
/*@}*/

/** @name Bit meaning in attribute byte
* (see color definitions in system header file conio.h)
*/
/*@{*/
#define BLUE_FOREG  (1 << 0)  ///< Foreground blue bit
#define GREEN_FOREG (1 << 1)  ///< Foreground green bit
#define RED_FOREG   (1 << 2)  ///< Foreground red bit

#define STRONG      (1 << 3)  ///< Foreground intensity bit

#define BLUE_BACK   (1 << 4)  ///< Background blue bit
#define GREEN_BACK  (1 << 5)  ///< Background gren bit
#define RED_BACK    (1 << 6)  ///< Background red bit

#define AQUA_BACK		(BLUE_BACK | GREEN_BACK)
#define PURPLE_BACK		(BLUE_BACK | RED_BACK)
#define YELLOW_BACK		(GREEN_BACK | RED_BACK)
#define LIGHTGRAY_BACK	(BLUE_BACK | GREEN_BACK | RED_BACK)

//#define BLINK       (1 << 7)  ///< already defined in conio.h

#define NORMAL (RED_FOREG | GREEN_FOREG | BLUE_FOREG) ///< handy definition

Queue keys_queue;


char table[256 * CHR_H];
char* xpmLetters[91];
void initializeLetters();
Sprite* letterToSprite(char letter);
void destroyLetters(Sprite** letters);
void drawDialog(char* title,char* diag);
void initializeDialogs();
void drawText_at(char* text,int x,int y);


Bool printCharAt(char ch, int x, int y, char color,char backg);
/** Draw rectangular frame with left upper corner at position x,y
* with width and height dimensions, decorated with title attributes.
* return true if sucessfull
*/
Bool drawFrame(char *title, char  color, char backg,
	int x, int y, int width, int height);

ulong calcMemPosition(int x, int y);

Bool printStringAt(char *str, int x, int y,char color,char backg);

#endif /* FONT_H_ */
